fix: enhance tools parameter handling in agent retrieval

This commit is contained in:
Bobbie 2025-08-09 23:08:20 +05:30 committed by GitHub
commit 90372d38a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View File

@ -1384,7 +1384,19 @@ async def get_agents(
filtered_agents = []
tools_filter = []
if tools:
tools_filter = [tool.strip() for tool in tools.split(',') if tool.strip()]
# Handle case where tools might be passed as dict instead of string
if isinstance(tools, str):
tools_filter = [tool.strip() for tool in tools.split(',') if tool.strip()]
elif isinstance(tools, dict):
# If tools is a dict, log the issue and skip filtering
logger.warning(f"Received tools parameter as dict instead of string: {tools}")
tools_filter = []
elif isinstance(tools, list):
# If tools is a list, use it directly
tools_filter = [str(tool).strip() for tool in tools if str(tool).strip()]
else:
logger.warning(f"Unexpected tools parameter type: {type(tools)}, value: {tools}")
tools_filter = []
for agent in agents_data:
# Get version data if available and extract configuration

View File

@ -15,7 +15,7 @@ const API_URL = process.env.NEXT_PUBLIC_BACKEND_URL || '';
interface CustomMCPDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
onSave: (config: CustomMCPConfiguration) => Promise<void>;
onSave: (config: CustomMCPConfiguration) => void;
}
interface CustomMCPConfiguration {
@ -145,7 +145,7 @@ export const CustomMCPDialog: React.FC<CustomMCPDialogProps> = ({
try {
let configToSave: any = { url: configText.trim() };
await onSave({
onSave({
name: serverName,
type: serverType,
config: configToSave,